import DataGrid from 'devextreme/ui/data_grid';

export function config(i18nService: any) {
  DataGrid.defaultOptions({
    device: { deviceType: 'desktop' },
    options: {
      twoWayBindingEnabled: false,
      showBorders: true,
      showRowLines: true,
      showColumnLines: true,

      hoverStateEnabled: true,
      // rowAlternationEnabled: true,
      noDataText: i18nService.getValue('@no-data'),
      allowColumnResizing: true,
      allowColumnReordering: true,
      columnResizingMode: 'widget',
      columnAutoWidth: true,

      remoteOperations: {
        paging: true,
        sorting: true
      },

      selection: {
        mode: 'none',
        selectAllMode: 'page'
      },

      pager: {
        showPageSizeSelector: true,
        allowedPageSizes: [20, 50, 100],
        showNavigationButtons: true,
        showInfo: true,
        infoText: i18nService.getValue('@page-info')
      },

      paging: {
        pageSize: 20
      },

      loadPanel: {
        enabled: false,
        showPane: false,
        indicatorSrc: 'assets/img/loading_table.gif',
        text: ''
      },

      sorting: {
        mode: 'none',
        ascendingText: i18nService.getValue('@asc'),
        clearText: i18nService.getValue('@clear-sort'),
        descendingText: i18nService.getValue('@desc')
      },

      columnFixing: {
        enabled: true,
        texts: {
          fix: i18nService.getValue('@fixed'),
          leftPosition: i18nService.getValue('@fixed-left'),
          rightPosition: i18nService.getValue('@fixed-right'),
          unfix: i18nService.getValue('@no-fixed')
        }
      }
    }
  });
}
